package logic.table;

import logic.constants.DefaultConsts;
import logic.util.logutil.LogUtil;
import android.provider.BaseColumns;


/**
 * 联系人信息表
 * 
 * @author 刘宾
 * @date 2015年12月15日 下午2:38:29
 */
public class AddressBookInfoTable
{
	
	public static final String table = "t_addressbookinfo";
	
	public final class AddressBookInfoColums
	        implements
	        BaseColumns
	{
		/** 联系人编号 */
		public final static String CONTACT_ID     = "contactId";
		/** 云信ID */
		public final static String ACC_ID         = "accId";
		/** 分组编号 */
		public final static String GROUP_ID       = "groupId";
		/** 组内职位 0=组员 1=组长 2=副组长 */
		public final static String GROUP_POSITION = "groupPosition";
		/** 联系人姓名 */
		public final static String CONTACT_NAME   = "contactName";
		/** 通讯地址 */
		public final static String ADDRESS        = "address";
		/** 是否删除 y=是 n=否 */
		public final static String IS_DELETE      = "isDelete";
		/** 手机号码 */
		public final static String MOBILE_NUMBER  = "mobileNumber";
		/** 工作单位 */
		public final static String ORGANIZATION   = "organization";
		/** 联系电话 */
		public final static String PHONE_NUMBER   = "phoneNumber";
		/** 职务 */
		public final static String POSITION       = "position";
		/** 邮编 */
		public final static String POST_CODE      = "postCode";
		/** 组内排序号 */
		public final static String SORT_NUM       = "sortNum";
		/** 用户头像 */
		public final static String USER_HEAD      = "userHead";
		/** 用户ID */
		public final static String USER_ID        = "userId";
		
	}
	
	public static String getCreateTableSQL() {
		StringBuilder sb = new StringBuilder();
		sb.append("CREATE TABLE IF NOT EXISTS " + table + "(");
		sb.append(AddressBookInfoColums.CONTACT_ID + " INTEGER,");
		sb.append(AddressBookInfoColums.ACC_ID + " VARCHAR(50),");
		sb.append(AddressBookInfoColums.GROUP_ID + " INTEGER,");
		sb.append(AddressBookInfoColums.GROUP_POSITION + " INTEGER,");
		sb.append(AddressBookInfoColums.CONTACT_NAME + " VARCHAR(50),");
		sb.append(AddressBookInfoColums.ADDRESS + " VARCHAR(200),");
		sb.append(AddressBookInfoColums.IS_DELETE + " VARCHAR(10),");
		sb.append(AddressBookInfoColums.MOBILE_NUMBER + " VARCHAR(50),");
		sb.append(AddressBookInfoColums.ORGANIZATION + " VARCHAR(200),");
		sb.append(AddressBookInfoColums.PHONE_NUMBER + " VARCHAR(50),");
		sb.append(AddressBookInfoColums.POSITION + " VARCHAR(50),");
		sb.append(AddressBookInfoColums.POST_CODE + " VARCHAR(50),");
		sb.append(AddressBookInfoColums.SORT_NUM + " INTEGER,");
		sb.append(AddressBookInfoColums.USER_HEAD + " VARCHAR(200),");
		sb.append(AddressBookInfoColums.USER_ID + " VARCHAR(50)");
		sb.append(");");
		LogUtil.d(DefaultConsts.TAG, table + ":" + sb.toString());
		return sb.toString();
	}
}
